/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Metodos;

import java.util.Scanner;

/**
 *
 * @author Bryan
 *
 *
 *
 */
public class MetodosUtiles {

//    COPIAR ESTO
//    
//    import static Metodos.MetodosUtiles.*;
//    
    public static int pedirInt(String queEs) {
        int x;
        Scanner lec = new Scanner(System.in);
        System.out.println("Introduce  el/la " + queEs);
        x = lec.nextInt();
        return x;
    }

    public static String pedirString(String queEs) {
        String x;
        Scanner lec = new Scanner(System.in);
        System.out.println("Introduce  el/la " + queEs);
        x = lec.nextLine();
        return x;
    }

    public static char pedirChar(String queEs) {
        String x;
        Scanner lec = new Scanner(System.in);
        System.out.println("Introduce  el/la " + queEs);
        return lec.next().charAt(0);
    }

    public static double pedirDouble(String queEs) {
        double x;
        Scanner lec = new Scanner(System.in);
        System.out.println("Introduce  el/la " + queEs);
        x = lec.nextDouble();
        return x;
    }

    public static void linea(String texto) {
        if (texto.equals("")) {
            System.out.println("|---------------------------------|");
        } else {

            texto = " " + texto + " ";
            System.out.println("|----------------" + texto + "-----------------|");
        }

    }

    public static void linea() {
        linea("");
    }

    public static int Aleatorio(int maximo) {
        maximo -= 1;
        return (int) ((Math.random() * maximo) + 1);
    }

    public static int Aleatorio() {
        return Aleatorio(9);
    }

    public static double maximoComunDivisor(double v1, double v2) {
        double retur = 0;
        double aux;
        if (v2 > v1) {
            double auxInterna;
            auxInterna = v2;
            v2 = v1;
            v1 = auxInterna;
        }
        while (v2 > 0) {
            aux = v1 % v2;
            v1 = v2;
            v2 = aux;
        }

        return v1;
    }
}
